home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-13 | 3.2 KB | 170 lines | [TEXT/MPS ] |
- //%CPW_START%
- /**************************************************************
- COPYRIGHT © 1993-94, VISIGENIC SOFTWARE, INC., ALL RIGHTS RESERVED.
- THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF
- VISIGENIC SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN
- CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR
- DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT
- SIGNED BY VISIGENIC, INC.
-
- THIS MATERIAL IS A CONFIDENTIAL TRADE SECRET AND PROPRIETARY
- INFORMATION OF VISIGENIC SOFTWARE, INC., AND MAY NOT BE REPRODUCED,
- USED, SOLD OR TRANSFERRED TO ANY THIRD PARTY WITHOUT THE PRIOR WRITTEN
- CONSENT OF THE VISIGENIC SOFTWARE, INC. THIS MATERIAL IS ALSO
- COPYRIGHTED AS AN UNPUBLISHED WORK UNDER TITLE 17 OF THE UNITED STATES
- CODE. UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED
- BY LAW.
-
-
- *************************************************************/
- /*
- $Header$
-
- $Log$
- */
- //%CPW_END%
- /* WinUtils.c : Provides a set of Windows Utility routines on the Macintosh */
-
- #include <CType.h>
- #include <stdlib.h>
-
- //#include <stdio.h>
- //#include <math.h>
-
- #include "WinUtils.h"
-
-
- char *_itoa(int value, char *string, int radix )
- {
- register int i, j, sFlag;
- char buf[18];
-
- if ( !value ) {
- string[0] = '0';
- string[1] = '\0';
- return string;
- }
-
- sFlag = (radix == 10) && (value < 0);
- value = abs(value);
-
- for ( i = j = 0 ; value && (i < 17) ; i++)
- {
- if ( (buf[i] = value % radix) > 9 )
- buf[i] += 'a' - 10;
- else
- buf[i] += '0';
- value /= radix;
- }
- if ( sFlag )
- buf[i++] = '-';
-
- while ( i-- )
- string[j++] = buf[i];
- string[j] = '\0';
-
- return string;
- }
-
- char * _ltoa(long value, char *string, int radix )
- {
- register int i, j, sFlag;
- char buf[34];
-
- if ( value == 0L )
- {
- string[0] = '0';
- string[1] = '\0';
- return string;
- }
-
- sFlag = (radix == 10) && (value < 0L);
- value = abs(value);
-
- for ( i = j = 0 ; (value != 0L) && (i < 33) ; i++ )
- {
- if ( (buf[i] = value % radix) > 9 )
- buf[i] += 'a' - 10;
- else
- buf[i] += '0';
- value /= radix;
- }
- if ( sFlag )
- buf[i++] = '-';
-
- while ( i--)
- string[j++] = buf[i];
- string[j] = '\0';
-
- return string;
- }
-
-
- char *_ultoa(unsigned long value, char *string, int radix )
- {
- register int i, j;
- char buf[34];
-
- if ( value == 0L ) {
- string[0] = '0';
- string[1] = '\0';
- return string;
- }
-
- for ( i = j = 0 ; (value != 0L) && (i < 34) ; i++) {
- if ( (buf[i] = value % radix) > 9 )
- buf[i] += 'a' - 10;
- else
- buf[i] += '0';
- value /= radix;
- }
- while ( i-- )
- string[j++] = buf[i];
- string[j] = '\0';
-
- return string;
- }
-
- char *
- strlwr( char *s)
- {
- register char *s1 = s;
-
- while (*s1)
- *(s1++) = tolower(*s1);
-
- return s1;
- }
-
- /*
- * Function - stricmp
- * The function performs a case independent comparison of its parameters
- * according to the ASCII collating sequence and returns an
- * integer less than, equal to, or greater than 0 when s1 is less
- * than, equal to, or greater than s2, respectively.
- *
- */
- int stricmp (const char *s1, const char *s2)
- {
- for(;*s1 && *s2; s1++, s2++)
- {
- if (toupper(*s1) != toupper(*s2) )
- {
- if (toupper(*s1) > toupper(*s2) )
- return(1);
- else
- return(-1);
- }
- }
-
- if (!(*s1 && *s2))
- return(0);
- else
- {
- if (*s1)
- return(1);
- else
- return(-1);
- }
- }
-